package qq.retrofit.api;

import android.content.Context;

import java.util.Map;


public class ApiClient {
   private Retrofit mRetrofit;
   private Api mApi;
   private static ApiClient sApiClient;
   private ApiClient(final Context context) {
      mRetrofit = new Retrofit.Builder().baseUrl(GetApi.baseURL).addConverterFactory(GsonConverterFactory.create()).build();
      mApi = mRetrofit.create(Api.class);
   }
   public static ApiClient getInstance(Context context) {
      if (sApiClient == null) {
         sApiClient = new ApiClient(context);
      }
      return sApiClient;
   }
   public static void destoryInstance() {
      if (sApiClient != null) {
         sApiClient = null;
      }
   }
   public String getRootURL() {
      return GetApi.baseURL;
   }

   public Call<RegisterResultBean> getReturnData(Map<String,String> map,RegisterSendBean registerSendBean){
      return mApi.register(map,registerSendBean);
   }

   public Call<LoginResultBean> getReturnData(Map<String,String> map, LoginSendBean loginSendBean){
      return mApi.login(map,loginSendBean);
   }

   public Call<ResetPwdResultBean> getReturnData(Map<String,String> map, ResetPwdSendBean resetPwdSendBean){
      return mApi.resetPwd(map,resetPwdSendBean);
   }

   public Call<EditResultBean> getReturnData(Map<String,String> map, EditSendBean editSendBean){
      return mApi.edit(map,editSendBean);
   }
   public Call<ListResultBean> getReturnData(Map<String,String> map, Map<String,String> map1){
      return mApi.list(map,map1);
   }
   public Call<GetByUserNameResultBean> getReturnData1(Map<String,String> map, Map<String,String> map1){
      return mApi.getByUserName(map,map1);
   }
   public Call<ClassesListResultBean> getReturnData2(Map<String,String> map, Map<String,String> map1){
      return mApi.classeslist(map,map1);
   }
}
